package pl.edu.pw.stud.ltrzaska.mvc.view;

import java.io.File;

import javax.swing.filechooser.FileFilter;

import org.apache.commons.io.FilenameUtils;

public class XmlFileFilter extends FileFilter {

	@Override
	public boolean accept(File inFile) {
		if (inFile.isFile()) {
			String ext = FilenameUtils.getExtension(inFile.getName());
			boolean isXmlExt = "xml".equals(ext);
			if (isXmlExt) {
				return true;
			}
		}
		if(inFile.isDirectory()) {
			return true;
		}
		return false;
	}

	@Override
	public String getDescription() {
		return "Plik polityki poprawnosci (.xml)";
	}

}
